﻿using Sustainalytics.ClientDW.Entities;
using System;

namespace Sustainalytics.GCCS.Service
{
    public class GCPrincipleSummaryDto
    {
        public Guid Id { get; set; }
        public Guid CompanyId { get; set; }
        public string Issue { get; set; }
        public GCPrincipleTemplateDto Principle { get; set; }
        public GCAssessment PrincipleAssessment { get; set; }
        public DateTime PrincipleAssessmentEffectiveSince { get; set; }
        public string PrincipleAssessmentEffectiveSinceQuarter
        {
            get
            {
                var quarter = GCCSUtility.GetDefaultFormattedGccsQuarter(this.PrincipleAssessmentEffectiveSince);
                return quarter;
            }
        }


        public virtual GCPrincipleSummaryDto LoadFrom(GCPrincipleSummary data)
        {
            this.Principle = data.Principle == null ? null : new GCPrincipleTemplateDto().LoadFrom(data.Principle);

            this.Id = data.Id;
            this.CompanyId = data.CompanyId;
            this.Issue = data.Issue;
            this.PrincipleAssessment = data.PrincipleAssessment;
            this.PrincipleAssessmentEffectiveSince = data.PrincipleAssessmentEffectiveSince;

            return this;
        }
    }
}
